<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/**
 * 心灵驿站文字数据表
 *
 * Date: 19/03/2018
 * @author George
 */
class CreateArticlesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('articles', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('company_id')->comment('公司ID');
            $table->string('title')->comment('标题');
            $table->string('cover')->comment('封面图片路径');
            $table->text('content')->comment('内容');
            $table->unsignedInteger('user_id')->index()->comment('作者ID');
            $table->timestamp('published_at')->comment('发布时间');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('articles');
    }
}
